package com.zhongda.cloud.service.security;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import com.zhongda.cloud.domain.User;

@Service
public class OAuthUserDetailsService implements UserDetailsService{

	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
		// TODO Auto-generated method stub
		User user = new User();
		user.setUsername(username);
		user.setPassword("password");
		if (user == null || username==null || username.equals("")) {
			throw new UsernameNotFoundException(username);
		}
		//return new User(user.getUsername(),user.getPassword(),grantedAuthorities);
		return user;
	}

}
